﻿namespace DotNetNuke.Modules._2DoTasks
{
    public partial class Messages : System.Web.UI.UserControl
    {
        #region "Aux Functions"

        /// <summary>
        /// Clears message labels, for warning and errors
        /// </summary>
        public void ClearMessages()
        {
            ShowError(string.Empty);
            ShowWarning(string.Empty);
            ShowSuccess(string.Empty);
            ShowInfo(string.Empty);
        }

        /// <summary>
        /// Shows an error message
        /// </summary>
        /// <param name="message">if empty hides the message control, else, shows the message</param>
        public void ShowError(string message)
        {
            pnl_error.Visible = !string.IsNullOrWhiteSpace(message);
            lt_error.Text = message;
        }

        /// <summary>
        /// Shows an warning message
        /// </summary>
        /// <param name="message">if empty hides the message control, else, shows the message</param>
        public void ShowWarning(string message)
        {
            pnl_warning.Visible = !string.IsNullOrWhiteSpace(message);
            lt_warning.Text = message;
        }

        /// <summary>
        /// Shows an success message
        /// </summary>
        /// <param name="message">if empty hides the message control, else, shows the message</param>
        public void ShowSuccess(string message)
        {
            pnl_success.Visible = !string.IsNullOrWhiteSpace(message);
            lt_success.Text = message;
        }

        /// <summary>
        /// Shows an information message
        /// </summary>
        /// <param name="message">if empty hides the message control, else, shows the message</param>
        public void ShowInfo(string message)
        {
            pnl_info.Visible = !string.IsNullOrWhiteSpace(message);
            lt_info.Text = message;
        }

        #endregion "Aux Functions"
    }
}